//
//  TitleButton.m
//  ChooseDemo
//
//  Created by pro on 2021/11/9.
//

#import "TitleButton.h"

@implementation TitleButton


-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor colorWithRed:32/255 green:38/255 blue:50/255 alpha:1];
        self.layer.cornerRadius = 4;
        self.clipsToBounds = YES;
    }
    return self;
}

-(UILabel *)titleL
{
    if (!_titleL) {
        _titleL = [[UILabel alloc] init];
        _titleL.font = [UIFont systemFontOfSize:12];
        _titleL.frame = CGRectMake(15, self.frame.size.height/2-6, self.frame.size.width-45, 12);
        _titleL.textColor = [UIColor whiteColor];

        _titleL.textAlignment = NSTextAlignmentCenter;
    }
    
    [self addSubview:_titleL];
    [self addSubview:self.imgView];
    return _titleL;
}
-(UIImageView *)imgView
{
    if (!_imgView) {
        _imgView = [[UIImageView alloc] init];
        _imgView.frame = CGRectMake(self.frame.size.width-25, (self.frame.size.height-5)/2, 10, 5);
        _imgView.image = [UIImage imageNamed:@"xialajiantou"];
    }

    return _imgView;
}
@end
